// 用户相关类型
export interface User {
  id: number
  username: string
  school?: string
  grade?: Grade
  avatar?: string
  stars?: number
  total_correct?: number
  total_wrong?: number
  continuous_days?: number
  last_login?: string
  // 管理员专用字段
  isAdmin?: boolean
  role?: 'super_admin' | 'admin' | 'teacher'
  real_name?: string
  permissions?: {
    user_management?: boolean
    content_management?: boolean
    data_analysis?: boolean
    system_settings?: boolean
    admin_management?: boolean
  }
}

export type Grade = '三上' | '三下' | '四上' | '四下' | '五上' | '五下' | '六上' | '六下'

export interface LoginForm {
  username: string
  password: string
}

export interface RegisterForm extends LoginForm {
  school: string
  grade: Grade
  avatar?: string
}

// 单词相关类型
export interface Word {
  id: number
  word: string
  phonetic: string
  chinese: string
  grade: Grade
  unit: string
  image_url?: string
  audio_url?: string
  mastery_level?: number
  correct_count?: number
  wrong_count?: number
  last_reviewed?: string
}

// 宠物相关类型
export interface Pet {
  id: number
  user_id: number
  pet_type: string
  pet_name: string
  level: number
  exp: number
  hunger: number
  happiness: number
  health: number
  last_fed?: string
  last_played?: string
}

// 游戏相关类型
export type GameType = 'match' | 'rain' | 'puzzle' | 'monopoly' | 'pronunciation'

export interface GameRecord {
  id: number
  user_id: number
  game_type: GameType
  score: number
  correct_count: number
  wrong_count: number
  duration: number
  played_at: string
}

// 成就相关类型
export interface Achievement {
  id: number
  name: string
  description: string
  icon: string
  category: string
  requirement_type: string
  requirement_value: number
  stars_reward: number
  unlocked?: boolean
  unlocked_at?: string
}

// 排行榜相关类型
export interface LeaderboardItem {
  id: number
  username: string
  school: string
  grade: Grade
  avatar: string
  stars: number
  total_correct: number
  total_wrong: number
  accuracy: number
  words_learned: number
  pet_level: number
  rank: number
}

// API响应类型
export interface ApiResponse<T = any> {
  success: boolean
  message: string
  data?: T
}

